/**
 * Created by 游永年 on 2019/3/16.
 */
'use strict'
import {connect} from 'dva';
import React, {Component} from 'react';
import styles from './user.less';

class Study extends Component {

  UNSAFE_componentWillMount() {
    this.props.dispatch({type: 'user/getOrderList'});
  }

  render() {
    return (
      <div>
        <ul className={styles.list}>
          <h2>订单列表</h2>
          {
            this.props.data.map(({testCode = 0, startTime = ''}, index) => {
              return <li key={'' + index} className={styles.li}>
                <div style={{
                  display: 'flex',
                  justifyContent: 'space-around',
                  padding: '15px 0px',
                }}>
                  <div>
                    {`第${index + 1}次:`}
                  </div>
                  <div>
                    <span style={{fontSize: '30px', color: 'rgb(255, 110, 39)'}}>{testCode}</span>分
                  </div>
                  <div style={{marginBottom: '8px', fontWeight: 'bold'}}>{`${startTime}`}</div>
                </div>
              </li>;
            })
          }
        </ul>
      </div>
    );
  }
}

Study.propTypes = {};

const opts = ({user}) => {
  const {orderList = []} = user || {};
  return {data: orderList};
};
export default connect(opts)(Study);
